export function loadJson (str){
    return new Promise(function (resolve, reject) {
        var json = JSON.parse(str);
        if(json ?? json.code==1001){
            resolve(json.data);
        }else{
            reject(json.msg)
        }
        
 
     });
}
    var str = `{
        "code": 1001,
        "msg": "操作成功",
        "data": [
                {
                    "icon": "&#xe653;",
                    "name": "自带js学习",
                    "subMenus": [
                        {
                            "icon": "",
                            "name": "学习第一课",
                            "url": "/demo1/index1/223"
                        },
                        {
                            "icon": "",
                            "name": "第二课",
                            "url": "/demo1/index2/3333"
                        },
                        {
                            "icon": "",
                            "name": "留着备用",
                            
                             "url": "/demo1/index3/3333"
                        },
                        {
                            "icon": "",
                            "name": "留着备用",
                            "url": "/demo1/index4/3333"
                        }
                    ],
                    "url": "/demo1"
                },
                {
                    "icon": "&#xe65e;",
                    "name": "ui样式",
                    "subMenus": [
                        {
                            "icon": "",
                            "name": "基础配置",
                            "url": "#/finance/card"
                        },
                        {
                            "icon": "",
                            "name": "员工管理",
                            "url": "#/finance/user"
                        },
                        {
                            "icon": "",
                            "name": "客户管理",
                            "url": "#/customer_lst"
                        },
                        {
                            "icon": "",
                            "name": "供货商管理",
                            "url": "#/supplier_lst"
                        },
                        {
                            "icon": "",
                            "name": "收支管理",
                            "url": "#/pay_lst"
                        },
                        {
                            "icon": "",
                            "name": "财务分析",
                            "url": "#/income_lst"
                        }
                    ],
                    "url": "/demo2/index1/223"
                },
                {
                    "icon": "&#xe716;",
                    "name": "使用交互",
                    "subMenus": [
                        {
                            "icon": "",
                            "name": "打印设置",
                            "url": "#/system_print"
                        }
                    ],
                    "url": "/demo3/index1/223/888555444"
                }
            
        ]
    }`

/* 	
 *  取顶部导航数据
 */
export async function getHeadMent(params = {
	openid: null
}) {
	return await loadJson(str)
}

/* 	
 *  取左侧导航数据
 */
export async function getNavbar(params = {
	openid: null
}) {
	return await loadJson(str)
}
